//orderlist.js
const app = getApp();

Page({
  data: {
    current: '0',
    orderState: '2',
    orderType: '1',
    wayState: "0",
    orderLogistics: true,
    confirmreceipt: true,
    animationData: {},
    animationDatas:{}
  },
  onLoad: function () {
    let that = this;
    const eventChannel = that.getOpenerEventChannel();
    // eventChannel.emit('orderlistPage', {data: 'test'});
    eventChannel.on('orderlistPage', function(data) {
      that.setData({
        wayState:data.data
      })
    })
  },
  menulist:function(e){
    let that = this;
    let num = e.currentTarget.dataset.num;
    that.setData({
        current: num
    })
  },
  orderMsg: function () {
    wx.navigateTo({
       url: '/packageA/pages/ordermsg/ordermsg'
    })
  },
  orderLogistics: function () {
    let that = this;
    that.setData({
      orderLogistics: false
      }, () => {
        let animation = wx.createAnimation({
            duration: 500,
            timingFunction: 'ease'
        })
         that.animation = animation
         setTimeout(function(){
           that.big();
        },200)
    })
  },
  orderLogisticsClose: function () {
    let that = this;
    that.setData({
      orderLogistics: true
      }, () => {
        let animation = wx.createAnimation({
            duration: 500,
            timingFunction: 'ease'
        })
         that.animation = animation
         setTimeout(function(){
           that.small();
        },200)
    })
  },
  big: function () {
    let that = this;
    that.animation.scale(1).step()
    that.setData({
      animationData: that.animation.export()
    })
  },
  small: function () {
    let that = this;
    that.animation.scale(0).step()
    that.setData({
      animationData: that.animation.export()
    })
  },
  confirmReceipt: function () {
    let that = this;
    that.setData({
      confirmreceipt: false
      }, () => {
        let animation = wx.createAnimation({
            duration: 500,
            timingFunction: 'ease'
        })
         that.animation = animation
         setTimeout(function(){
           that.bigs();
        },200)
    })
  },
  confirmReceiptClose: function () {
    let that = this;
    that.setData({
      confirmreceipt: true
      }, () => {
        let animation = wx.createAnimation({
            duration: 500,
            timingFunction: 'ease'
        })
         that.animation = animation
         setTimeout(function(){
           that.smalls();
        },200)
    })
  },
  bigs: function () {
    let that = this;
    that.animation.scale(1).step()
    that.setData({
      animationDatas: that.animation.export()
    })
  },
  smalls: function () {
    let that = this;
    that.animation.scale(0).step()
    that.setData({
      animationDatas: that.animation.export()
    })
  }
})
